﻿using System.Drawing;
using System.Web;

namespace WebImageResizer.Filters
{
	internal class GreyScaleFilter : IImageFilter
	{
		#region IImageFilter Members

		public bool Process(HttpContext context, ref Bitmap bitmap)
		{
			string greyScaleParameter = context.Request["greyscale"];
			if (string.IsNullOrEmpty(greyScaleParameter))
			{
				return false;
			}

			IImageTool imageTool = Factory.GetImageTool();
			bitmap = imageTool.ToGreyScale(bitmap);
			return true;
		}

		#endregion
	}
}